using RuoVea.ExSugar.Attributes;
using System.ComponentModel.DataAnnotations;
using Serialization = System.Text.Json.Serialization;

namespace RuoVea.OmiApi.SystemApp.Entitys;


/// <summary>
/// 用户表
/// </summary>
[SugarTable(nameof(SysUser), "用户表")]
[Description("用户表")]
[Tenant("0")]
[SugarIndex("index_{table}_A", nameof(Account), OrderByType.Asc)]
[SugarIndex("index_{table}_P", nameof(Phone), OrderByType.Asc)]
public partial class SysUser : EntityBase, ITenantEntity
{
    /// <summary>
    /// 租户Id
    /// </summary>
    [ConfigSugarTenantColumn("TenantId", "租户Id", false, true, false)]
    public long? TenantId { get; set; }
    /// <summary>
    /// 账号
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Account), columnDescription:"账号", Length = 32)]
    [Required, MaxLength(32)]
    public virtual string Account { get; set; }

    /// <summary>
    /// 密码（默认MD5加密）
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Password), columnDescription:"密码", IsNullable = true, Length = 512)]
    [MaxLength(512)]
    [Newtonsoft.Json.JsonIgnore]
    [Serialization.JsonIgnore]
    public string Password { get; set; }

    /// <summary>
    /// 昵称
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(NickName), columnDescription:"昵称", IsNullable = true, Length = 32)]
    [MaxLength(32)]
    public string NickName { get; set; }

    /// <summary>
    /// 姓名
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(RealName), columnDescription:"真实姓名", IsNullable = true, Length = 32)]
    [MaxLength(32)]
    public virtual string RealName { get; set; }

    /// <summary>
    /// 头像
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Avatar), columnDescription:"头像", IsNullable = true, Length = 512)]
    [MaxLength(512)]
    public string Avatar { get; set; }
    /// <summary>
    /// 性别-男_1、女_2
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Sex), columnDescription:"性别", IsNullable = true)]
    public Gender? Sex { get; set; }
    /// <summary>
    /// 出生日期
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Birthday), columnDescription:"出生日期", IsNullable = true)]
    public DateTime? Birthday { get; set; }

    /// <summary>
    /// 邮箱
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Email), columnDescription:"邮箱", Length = 64, IsNullable = true)]
    [MaxLength(64)]
    public string Email { get; set; }
    /// <summary>
    /// 邮箱校验
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(EmillValid), columnDescription:"邮箱校验", IsNullable = true)]
    public int? EmillValid { get; set; }

    /// <summary>
    /// 手机
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Phone), columnDescription:"手机", IsNullable = true)]
    public string Phone { get; set; }

    /// <summary>
    /// 电话
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Tel), columnDescription:"电话", IsNullable = true)]
    public string Tel { get; set; }

    /// <summary>
    /// 最后登录IP
    /// </summary>
    [MaxLength(256)]
    [ConfigSugarColumn(columnKey: nameof(LastLoginIp), columnDescription:"最后登录IP", Length = 256, IsNullable = true)]
    public string LastLoginIp { get; set; }

    /// <summary>
    /// 最后登录时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(LastLoginTime), columnDescription:"最后登录时间", IsNullable = true)]
    public DateTime? LastLoginTime { get; set; }

    /// <summary>
    /// 管理员类型-超级管理员_1、非管理员_2
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(AdminType), columnDescription:"管理员类型", IsNullable = true)]
    public AdminType? AdminType { get; set; }

    /// <summary>
    /// 状态-正常_0、停用_1 
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(IsDisable), columnDescription:"是否禁用", IsNullable = true)]
    public YesOrNot? IsDisable { get; set; }  

    /// <summary>
    /// 备注
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Remark), columnDescription:"备注", IsNullable = true, Length = 256)]
    [MaxLength(256)]
    public string Remark { get; set; }
    /// <summary>
    /// 电子签名
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Signature), columnDescription:"电子签名", Length = 512, IsNullable = true)]
    [MaxLength(512)]
    public string Signature { get; set; }

    /// <summary>
    /// 账号类别 0普通账号 GITEE GITHUB ...
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Category), columnDescription:"账号类别", IsNullable = true)]
    public CategoryEnum? Category { get; set; }

    /// <summary>
    /// oAuth  ClientId
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(ClientId), columnDescription:"ClientId", IsNullable = true)]
    public string ClientId { get; set; }
}